<?php
    $this->title = 'Index';
    $this->headTitle($this->title);
    $this->exturl = '?';
    if ($this->page != 1) $this->exturl .= 'page=' . $this->page;
    if ($this->sort != '') $this->eexturl .= '&sort=' . $this->sort;
?>
<div id="welcome">
        <table id="hor-minimalist-b">
            <tr>                    
                <th>#</th>
                <th><a href="?sort=name<?php if ($this->page != 1) echo '&page=' . $this->page;?>" id="api-sort" title="Sắp xếp theo tên">API</a></th>
                <th><a href="?sort=count<?php if ($this->page != 1) echo '&page=' . $this->page;?>" id="count-sort" title="Sắp xếp">Tổng số lần gọi</a></th>
            </tr>
            <?php $i = MAXITEM * $this->page - MAXITEM; foreach($this->apis as $api) :?>
            <tr>
            	<td><?php echo ++$i?></td>
                <td><?php echo $api->lapi_name ;?></td>
                <td><?php echo $api->count ;?></td>
            </tr>
            <?php  endforeach; ?>
        </table>
<ul id="pagination-flickr">
            <?php if ($this->page <= MAXITEM):?>
                <li class="previous-off" >Trước</li>
            <?php else :?>
                <li class="previous"><a href="?page=<?php echo $this->begin - 1; if ($this->sort != '') echo '&sort=' . $this->sort;?>">Trước</a></li>
            <?php endif;
            
            
	
	            for($i = $this->begin; $i <= $this->end; $i++) :
			            if ($i == $this->page) :?>
					<li class="active"><?php echo ( $i ) ;?></li>
					<?php else : ?>
			
					<li><a href="?page=<?php echo $i ; if ($this->sort != '') echo '&sort=' . $this->sort;?>"><?php echo $i ;?> </a></li>
					<?php endif;
				endfor;
			 
		 	if ($this->end % MAXITEM == 0 && $this->end * MAXITEM != $this->total) :
		?>
                
                    <li class="next"><a title="Trang kế tiếp"
                     href="?page=<?php echo $this->end + 1; if ($this->sort != '') echo '&sort=' . $this->sort;?>">Tiếp</a></li>
                <?php else :?>
                
                    <li class="next-off">Tiếp</li>
                <?php endif;?>
        </ul>          
    <br>     
   
<!--     <div class="form-item"> -->
<!--         <label for="name">Số lượng dòng trên trang:</label> -->
<!--         <select>-->
<!--         	<option>3</option>-->
<!--         	<option>5</option>-->
<!--         	<option>10</option>-->
<!--         </select> -->
<!--     </div> -->
</div>

<form method="post" action="<?php echo $this->exturl?>" id='frm-filter'>
	<div class="form-item">
		<label for="num">Số lần gọi lớn hơn:</label> 
		<input id="num" name='num' type="text" class="form-text" <?php if (isset($_COOKIE['mincount'] )) echo 'value="' . $_COOKIE["mincount"] . '"'?> />
	</div>
	<input type="submit" class="white button" value="OK"/>
</form>


<div id="time-filter">
	<fieldset>
		<legend>Giới hạn thời gian lấy dữ liệu</legend>
		<div>
			<form method="post" action="<?php echo $this->exturl?>">
				<label for="from">Từ</label>
				<input type="text" name="from" id="from" />
				
				<label for="to">Đến</label>
				<input type="text" name="to" id="to" />
				
				<input class="white button" type="submit"  />
			</form>
		</div>
	</fieldset>
</div>

<script type="text/javascript">
		$(function() {
			$( "#from" ).datepicker().datepicker( "option", "dateFormat", "yy-mm-dd");;
			$( "#to" ).datepicker().datepicker( "option", "dateFormat", "yy-mm-dd");;
		});
</script>

